<template>
  <view class="content">
    <image mode="widthFix" class="img" :src="src"></image>
    <view class="tips">{{tipText}}</view>
    <button class="btn" size="mini" type="primary" hover-class="none" @click="btnFun">{{btnText}}</button>
  </view>
</template>

<script>
  import successimg from "./success.png"
  import warnimg from "./warn.png"
  import failimg from "./fail.png"
  export default {
    name:'chenchenxuxu-result',
  	data() {
  		return {
  			src:''
  		}
  	},
    props: {
    	type: {
    		type: String,
    		default: 'success'
    	},
      tipText: {
      	type: String,
      	default: '操作成功'
      },
      btnText: {
      	type: String,
      	default: '确定'
      },
    },
    created(){
      switch(this.type){
        case 'success':
          this.src=successimg;
          break;
        case 'warn':
          this.src=warnimg;
          break;
        case 'fail':
          this.src=failimg;
          break;
      }
    },
    methods: {
      btnFun(){
        this.$emit("click")
      }
    },
  }
</script>

<style lang="scss" scoped>
  .content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
    .img{
      width:80px;
      height:80px;
      margin:100px 0 15px 0;
    }
    .tips{
      font-size:16px;
      color:#666;
      margin:30px 0 100px 0;
    }
	}
</style>